MACRO := -DCLWB #-DDEBUG
CFLAGS := -std=c++11 -msse2 -mavx -mclwb -mclflushopt -mrdrnd -fmax-errors=5 -fopenmp
LINK_LIB_FLAGS := -lpmem -pthread -fopenmp

SOURCES := $(wildcard *.cc)
OBJECTS := $(SOURCES:.cc=.o)

all: $(OBJECTS) 
	g++ -o pattern pattern.o access.o $(LINK_LIB_FLAGS) 
	g++ -o bandwidth bandwidth.o access.o $(LINK_LIB_FLAGS)
	g++ -o latency latency.o access.o $(LINK_LIB_FLAGS)
	@echo "finish compile"

%.o: %.cc
	g++ $(MACRO) $(CFLAGS) -c -o $@ $<

.PONHY: clean
clean:
	@rm *.o bandwidth pattern latency
